#include <stdio.h>
#include <math.h>

int main()
{
    int input = 0;
    char ch[7] = {0, 0, 0, 0, 0, 0, 0};
    scanf("%d", &input);
    if(input <= 0 || input >= 1000000)
    {
        printf("-1\n");
        return -1;
    }
    ch[5] = input / 100000  + 0x30;
    ch[4] = input % 100000 / 10000 + 0x30;
    ch[3] = input % 10000  / 1000 + 0x30;
    ch[2] = input % 1000   / 100 + 0x30;
    ch[1] = input % 100    / 10 + 0x30;
    ch[0] = input % 10 + 0x30;
    int i = 5;
    while (ch[i] == 0x30)
    {
        ch[i] = 0;
        i --;
    }
    
    printf("%s", ch);
    putchar('\n');
    return 0;
}